/************************************************************************************************************************************
 *File     : transform.vs
 *Author   : cpzhang<chengpengzhang@gmail.com>
 *Date     : 2010-4-21
 *Platform : Windows XP, 32-bit, MSVC++ 2005, NVIDIA GeForce 9500 GT, 512M
 *Desc     : Vertex Shader that transforms a vertex by the view and projection transformation, and sets the vertex color to blue
***********************************************************************************************************************************/

/* global variable to store a combined view and projection transformation matrix.
 * We initialize this variable from the application. */
matrix<float, 4, 4> viewProjectionMatrix;

/* global variable to store a blue color
 * Format : R-G-B-A
 * */
const vector<float, 4> blue = {0.0f, 0.0f, 1.0f, 1.0f}; 

/* input structure */
struct VS_INPUT
{
	vector<float, 4> position : POSITION;
};

/* output structure */
struct VS_OUTPUT
{
	vector<float, 4> position : POSITION;
	vector<float, 4> diffuse  : COLOR;
};

/* main entry point */
VS_OUTPUT main(VS_INPUT input)
{
	/* zero out output */
	VS_OUTPUT output = (VS_OUTPUT)0;

	/* transform */
	output.position = mul(input.position, viewProjectionMatrix);

	/* color */
	output.color = blue;

	/* return */
	return output;
}
